package com.jxmcloud.business.cut.service.impl.database;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jxmcloud.business.cut.mapper.database.IUserWatchLiveTaskDetailDBMapper;
import com.jxmcloud.business.cut.model.database.DBUserWatchLiveTaskDetail;
import com.jxmcloud.business.cut.service.database.IUserWatchLiveTaskDetailDBService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserWatchLiveTaskDetailDBServiceImpl extends ServiceImpl<IUserWatchLiveTaskDetailDBMapper, DBUserWatchLiveTaskDetail> implements IUserWatchLiveTaskDetailDBService {
    @Override
    public boolean insertIntoData(DBUserWatchLiveTaskDetail info) {
        return this.baseMapper.insert(info) == 1;
    }

    @Override
    public DBUserWatchLiveTaskDetail selectOne(Integer uid) {
        return this.baseMapper.selectById(uid);
    }

    @Override
    public List<DBUserWatchLiveTaskDetail> selectAll(List<Integer> uid) {
        QueryWrapper<DBUserWatchLiveTaskDetail> wrapper = new QueryWrapper<>();
        wrapper.in("id", uid);
        return this.baseMapper.selectList(wrapper);
    }

    @Override
    public boolean deleteData(Integer uid) {
        QueryWrapper<DBUserWatchLiveTaskDetail> wrapper = new QueryWrapper<>();
        wrapper.eq("uid", uid);
        return this.baseMapper.delete(wrapper) == 1;
    }

    @Override
    public boolean updateData(DBUserWatchLiveTaskDetail info) {
        return this.baseMapper.updateById(info) == 1;
    }
}
